package com.longjianghuasheng.logistics.business.main

import android.content.Intent
import android.os.Bundle
import com.longjianghuasheng.logistics.R
import com.longjianghuasheng.logistics.base.BaseActivity
import com.longjianghuasheng.logistics.databinding.ActivityGuideBinding
import com.longjianghuasheng.logistics.util.CacheUtil
import com.xuexiang.xui.utils.StatusBarUtils
import com.xuexiang.xui.widget.banner.anim.select.ZoomInEnter
import com.xuexiang.xui.widget.banner.transform.DepthTransformer
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel

class GuideActivity : BaseActivity<BaseViewModel, ActivityGuideBinding>() {
    private val resList by lazy {

        listOf(
            R.drawable.guide_img_1,
            R.drawable.guide_img_2,
            R.drawable.guide_img_3,
            R.drawable.guide_img_4
        )
    }

    override fun layoutId(): Int {
        return R.layout.activity_guide
    }

    override fun initView(savedInstanceState: Bundle?) {
        StatusBarUtils.initStatusBarStyle(this, true)

        mDatabind.sgb.run {

            setIndicatorWidth(6f)
                .setIndicatorHeight(6f)
                .setIndicatorGap(12f)
                .setIndicatorCornerRadius(3.5f)
                .setSelectAnimClass(ZoomInEnter::class.java)
                .setTransformerClass(DepthTransformer::class.java)
                .barPadding(0f, 10f, 0f, 10f)
                .setSource(resList)
                .startScroll()

            setOnJumpClickListener {

                CacheUtil.isFirst = false
                startActivity(
                    Intent(
                        this@GuideActivity,
                        MainActivity::class.java
                    )
                )
                finish()
                overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)

            }
        }


    }
}